﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;

namespace ZDSoft.QLMS.Entity.SystemSetting
{
    [ActiveRecord]
    public class SystemFunction : EntityBase<SystemFunction>
    {
        /// <summary>
        /// 功能名称
        /// </summary>
        [Property]
        public string SystemFunctionName { get; set; }

        /// <summary>
        /// 功能类名
        /// </summary>
        [Property]
        public string ClassName { get; set; }

        /// <summary>
        /// 控制器名称
        /// </summary>
        [Property]
        public string ControllerName { get; set; }

        /// <summary>
        /// 方法名称
        /// </summary>
        [Property]
        public string ActionName { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        [Property]
        public bool IsActive { get; set; }

        /// <summary>
        /// 父级功能
        /// </summary>
        [BelongsTo("ParentID")]
        public SystemFunction Parent { get; set; }

        /// <summary>
        /// 子级功能
        /// </summary>
        [HasMany(typeof(SystemFunction), ColumnKey = "ParentID")]
        public IList<SystemFunction> Childern { get; set; }

        /// <summary>
        ///可操作当前功能的角色
        /// </summary>
        [HasAndBelongsToMany(typeof(Role), Table = "Role_SystemFunction", ColumnRef = "RoleID", ColumnKey = "FunctionID")]
        public IList<Role> Roles { get; set; }
    }
}
